#include <GL/glut.h>
void mydisplay(){
     glClear(GL_COLOR_BUFFER_BIT); 
	glBegin(GL_POLYGON);        
		glVertex2f(-0.6, -0.6);        
		glVertex2f(-0.6,0.6);        
		glVertex2f(0.6, 0.6);        
		glVertex2f(0.6, -0.6);    
	glEnd();
	glFlush(); 
}

void init()
{
	glClearColor (0.0, 1, 0.0, 1.0);

	glColor3f(1.0, 0.5, 1.0); 

	glMatrixMode (GL_PROJECTION);    
	glLoadIdentity ();    
	glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);  
}

void reshape (int w, int h)
{

    glViewport (0, 0, (GLsizei) w, (GLsizei) h);
    glMatrixMode (GL_PROJECTION);
    glLoadIdentity ();
    gluPerspective(60.0, (GLfloat) w/(GLfloat) h, 1.0, 20.0);
    glMatrixMode (GL_MODELVIEW);

}

void keyboard(unsigned char key, int x, int y)
{

    switch (key) {

        case 27: // ESC key
        exit(0);
        break;

    }

}

int main(int argc, char** argv){
	glutInit(&argc, argv);
	glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);  
	glutInitWindowSize(500,500);
	glutInitWindowPosition(0,0);
	glutCreateWindow("simple");     
	init();  
	//your code here
	glutDisplayFunc(mydisplay);  
	
	glutReshapeFunc(reshape);
	glutKeyboardFunc(keyboard);
	glutMainLoop();
}

